package com.example.demo.vo

import com.example.demo.dbmodels.TApk
import io.swagger.annotations.ApiModelProperty

class ApkVo {

    @ApiModelProperty(value = "id")
    var id: Int? = null

    @ApiModelProperty(value = "apk名称")
    var apkName: String? = null

    @ApiModelProperty(value = "apk版本号")
    var apkCode: String? = null

    @ApiModelProperty(value = "apk类型 0 床头卡 1 护士站看板")
    var apkType: Int? = null

    @ApiModelProperty(value = "apk保存的url")
    var apkPath: String? = null

    fun getVo(table: TApk): ApkVo {
        table.let {
            val data = ApkVo()
            data.id = it.id
            data.apkPath = it.apkPath
            data.apkCode = it.apkCode
            data.apkName = it.apkName
            data.apkType = it.apkType
            return data
        }
    }

    fun getListVo(table: List<TApk>): List<ApkVo> {
        table.let { list ->
            val listVo = mutableListOf<ApkVo>()
            list.forEach {
                val data = ApkVo()
                data.id = it.id
                data.apkPath = it.apkPath
                data.apkCode = it.apkCode
                data.apkName = it.apkName
                data.apkType = it.apkType
                listVo.add(data)
            }
            return listVo
        }
    }

}